<?php
	
	//连接数据库
	$db = mysqli_connect('127.0.0.1','root','','libo');
	//判断是否连接成功
	if (!mysqli_connect_errno($db)){
		//成功
		// echo "连接数据库成功";
		$username = $_POST['username'];
		$password = $_POST['password'];
		//判断是插入请求还是查询请求
			mysqli_query($db,'SET NAMES UTF8');

			$sql =  "SELECT * FROM register WHERE name = '$username' && password1 = '$password'";
			//执行
			 $result=mysqli_query($db,$sql);
			 //判断插入成功
			 if(mysqli_affected_rows($db)){
				echo json_encode(['code'=>1,'msg'=>'success']);
			}else{
				 echo json_encode(['code'=>0,'msg'=>'failed']);
			}
				

			 
	}	
	
?>